import request from '@/config/axios'

// 流量使用明细 VO
export interface FlowDetailVO {
  id: number // id主键
  flowId: number // 业务id
  originalTraffic: string // 原流量G
  variableTraffic: string // 变动流量G
  residualFlow: string // 剩余流量G
  timeConsuming: Date // 消耗时间
}

// 流量使用明细 API
export const FlowDetailApi = {
  // 查询流量使用明细分页
  getFlowDetailPage: async (params: any) => {
    return await request.get({ url: `/cost/flow-detail/page`, params })
  },

  // 查询流量使用明细详情
  getFlowDetail: async (id: number) => {
    return await request.get({ url: `/cost/flow-detail/get?id=` + id })
  },

  // 新增流量使用明细
  createFlowDetail: async (data: FlowDetailVO) => {
    return await request.post({ url: `/cost/flow-detail/create`, data })
  },

  // 修改流量使用明细
  updateFlowDetail: async (data: FlowDetailVO) => {
    return await request.put({ url: `/cost/flow-detail/update`, data })
  },

  // 删除流量使用明细
  deleteFlowDetail: async (id: number) => {
    return await request.delete({ url: `/cost/flow-detail/delete?id=` + id })
  },

  // 导出流量使用明细 Excel
  exportFlowDetail: async (params) => {
    return await request.download({ url: `/cost/flow-detail/export-excel`, params })
  },

  // 导出流量使用明细 Excel
  getBdFlow: async (params) => {
    return await request.get({ url: `/cost/flow/getBdFlowPage`, params })
  },
}
